﻿// ***********************************************************************
// Assembly         : MVC4Portal
// Author           : Lolo
// Created          : 09-21-2013
//
// Last Modified By : Lolo
// Last Modified On : 09-23-2013
// ***********************************************************************
// <copyright file="_SecurityControllers_Base.cs" company="">
//     Copyright (c) . All rights reserved.
// </copyright>
// <summary></summary>
// ***********************************************************************
using InnovaApp.Layers.ResourcesLayer.Properties;
using INNOVACALL.Framework.Common.MVCHelpers.Localization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;

namespace InnovaApp.Portals.MVC4Portal.Controllers.ViewControllers.LayoutViewControllers.SecurityControllers
{
    /// <summary>
    /// Class _SecurityControllers_Base.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public abstract class _SecurityControllers_Base<T> : _LayoutViewControllers_Base<T> where T : InnovaApp.Layers.CommonLayer.Models.ViewModels.LayoutViewModels._LayoutViewModels_Base
    {
        /// <summary>
        /// Errors the code to string.
        /// </summary>
        /// <param name="createStatus">The create status.</param>
        /// <returns>System.String.</returns>
        protected string ErrorCodeToString(MembershipCreateStatus createStatus)
        {
            // See http://go.microsoft.com/fwlink/?LinkID=177550 for
            // a full list of status codes.
            //ToDo uses Resources instead of strings
            switch (createStatus)
            {
                case MembershipCreateStatus.DuplicateUserName:
                    return Resources.EF_MembershipProvider_CreateStatus_UserAlreadyExists;

                case MembershipCreateStatus.DuplicateEmail:
                    return Resources.EF_MembershipProvider_CreateStatus_EMailAddressAlreadyUsed;

                case MembershipCreateStatus.InvalidPassword:
                    return Resources.EF_MembershipProvider_CreateStatus_PasswordNotValid;

                case MembershipCreateStatus.InvalidEmail:
                    return Resources.EF_MembershipProvider_CreateStatus_EMailAddressNotValid;

                case MembershipCreateStatus.InvalidAnswer:
                    return Resources.EF_MembershipProvider_CreateStatus_AnswerNotValid;

                case MembershipCreateStatus.InvalidQuestion:
                    return Resources.EF_MembershipProvider_CreateStatus_QuestionNotValid;

                case MembershipCreateStatus.InvalidUserName:
                    return Resources.EF_MembershipProvider_CreateStatus_UserNameNotValid;

                case MembershipCreateStatus.ProviderError:
                    return Resources.EF_MembershipProvider_CreateStatus_AuthenticationProviderError;

                case MembershipCreateStatus.UserRejected:
                    return Resources.EF_MembershipProvider_CreateStatus_UserRejected;

                default:
                    return Resources.EF_MembershipProvider_CreateStatus_UnknownError;
            }
        }
    }
}